<!DOCTYPE html>
<html lang="en">
  <head>
    <title>
        Docker-1-基础 - rulerLwx Blog
      </title>
        <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
      content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-transform" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no,email=no,adress=no">
    
    <meta name="theme-color" content="#000000" />
    
    <meta http-equiv="window-target" content="_top" />
    
    
    <meta name="description" content="什么是Docker？ 官网：https://www.docker.com/ 开源：https://github.com/docker Docker" />
    <meta name="generator" content="Hugo 0.73.0 with theme pure" />
    <title>Docker-1-基础 - rulerLwx Blog</title>
    
    
    <link rel="stylesheet" href="https://rulerLwx.gitee.io/css/style.min.c4bc7071f132c964c2116bca53b392933f377e5ca7b7051ed245187c621a2d3e.css">
    
    <link rel="stylesheet" href="https://cdn.staticfile.org/highlight.js/9.15.10/styles/github.min.css" async>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.4.2/tocbot.css" async>
    <meta property="og:title" content="Docker-1-基础" />
<meta property="og:description" content="什么是Docker？ 官网：https://www.docker.com/ 开源：https://github.com/docker Docker" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://rulerLwx.gitee.io/2017/08/docker-1-%E5%9F%BA%E7%A1%80/" />
<meta property="article:published_time" content="2017-08-01T10:02:01+08:00" />
<meta property="article:modified_time" content="2017-08-01T10:02:01+08:00" />
<meta itemprop="name" content="Docker-1-基础">
<meta itemprop="description" content="什么是Docker？ 官网：https://www.docker.com/ 开源：https://github.com/docker Docker">
<meta itemprop="datePublished" content="2017-08-01T10:02:01&#43;08:00" />
<meta itemprop="dateModified" content="2017-08-01T10:02:01&#43;08:00" />
<meta itemprop="wordCount" content="5365">



<meta itemprop="keywords" content="," /><meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="Docker-1-基础"/>
<meta name="twitter:description" content="什么是Docker？ 官网：https://www.docker.com/ 开源：https://github.com/docker Docker"/>

    <!--[if lte IE 9]>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/classlist/1.1.20170427/classList.min.js"></script>
      <![endif]-->

    <!--[if lt IE 9]>
        <script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
        <script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
      <![endif]-->
  </head>

  
  

  <body class="main-center theme-black" itemscope itemtype="http://schema.org/WebPage"><header class="header" itemscope itemtype="http://schema.org/WPHeader">
    <div class="slimContent">
      <div class="navbar-header">
        <div class="profile-block text-center">
          <a id="avatar" href="https://gitee.com/rulerLwx" target="_blank">
            <img class="img-circle img-rotate" src="https://rulerLwx.gitee.io/avatar.png" width="200" height="200">
          </a>
          <h2 id="name" class="hidden-xs hidden-sm">rulerLwx</h2>
          <h3 id="title" class="hidden-xs hidden-sm hidden-md">thinking...</h3>
          <small id="location" class="text-muted hidden-xs hidden-sm"><i class="icon icon-map-marker"></i>Guangzhou, China</small>
        </div><div class="search" id="search-form-wrap">
    <form class="search-form sidebar-form">
        <div class="input-group">
            <input type="text" class="search-form-input form-control" placeholder="Search" />
            <span class="input-group-btn">
                <button type="submit" class="search-form-submit btn btn-flat" onclick="return false;"><i
                        class="icon icon-search"></i></button>
            </span>
        </div>
        <div class="ins-search">
            <div class="ins-search-mask"></div>
            <div class="ins-search-container">
                <div class="ins-input-wrapper">
                    <input type="text" class="ins-search-input" placeholder="Type something..."
                        x-webkit-speech />
                    <button type="button" class="close ins-close ins-selectable" data-dismiss="modal"
                        aria-label="Close"><span aria-hidden="true">×</span></button>
                </div>
                <div class="ins-section-wrapper">
                    <div class="ins-section-container"></div>
                </div>
            </div>
        </div>
    </form>
</div>
        <button class="navbar-toggle collapsed" type="button" data-toggle="collapse" data-target="#main-navbar" aria-controls="main-navbar" aria-expanded="false">
          <span class="sr-only">Toggle navigation</span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
      </div>
      <nav id="main-navbar" class="collapse navbar-collapse" itemscope itemtype="http://schema.org/SiteNavigationElement" role="navigation">
        <ul class="nav navbar-nav main-nav">
            <li class="menu-item menu-item-home">
                <a href="/">
                    <i class="icon icon-home-fill"></i>
                  <span class="menu-title">Home</span>
                </a>
            </li>
            <li class="menu-item menu-item-archives">
                <a href="/posts/">
                    <i class="icon icon-archives-fill"></i>
                  <span class="menu-title">Archives</span>
                </a>
            </li>
            <li class="menu-item menu-item-categories">
                <a href="/categories/">
                    <i class="icon icon-folder"></i>
                  <span class="menu-title">Categories</span>
                </a>
            </li>
            <li class="menu-item menu-item-tags">
                <a href="/tags/">
                    <i class="icon icon-tags"></i>
                  <span class="menu-title">Tags</span>
                </a>
            </li>
            <li class="menu-item menu-item-about">
                <a href="/about/">
                    <i class="icon icon-cup-fill"></i>
                  <span class="menu-title">About</span>
                </a>
            </li>
        </ul>
      </nav>
    </div>
  </header>

<aside class="sidebar" itemscope itemtype="http://schema.org/WPSideBar">
  <div class="slimContent">
    
      <div class="widget">
    <h3 class="widget-title">Board</h3>
    <div class="widget-body">
        <div id="board">
            <div class="content">enjoy~
            </div>
        </div>
    </div>
</div>

      <div class="widget">
    <h3 class="widget-title"> Categories</h3>
    <div class="widget-body">
        <ul class="category-list">
            <li class="category-list-item"><a href="https://rulerLwx.gitee.io/categories/java-framework/" class="category-list-link">java-framework</a><span class="category-list-count">38</span></li>
            <li class="category-list-item"><a href="https://rulerLwx.gitee.io/categories/java-front-end/" class="category-list-link">java-front-end</a><span class="category-list-count">11</span></li>
            <li class="category-list-item"><a href="https://rulerLwx.gitee.io/categories/java-se/" class="category-list-link">java-se</a><span class="category-list-count">21</span></li>
            <li class="category-list-item"><a href="https://rulerLwx.gitee.io/categories/java-senior/" class="category-list-link">java-senior</a><span class="category-list-count">4</span></li>
            <li class="category-list-item"><a href="https://rulerLwx.gitee.io/categories/linux/" class="category-list-link">linux</a><span class="category-list-count">13</span></li>
            <li class="category-list-item"><a href="https://rulerLwx.gitee.io/categories/tools/" class="category-list-link">tools</a><span class="category-list-count">1</span></li>
            <li class="category-list-item"><a href="https://rulerLwx.gitee.io/categories/%E6%8A%80%E6%9C%AF%E6%9D%82%E7%83%A9/" class="category-list-link">技术杂烩</a><span class="category-list-count">4</span></li>
            <li class="category-list-item"><a href="https://rulerLwx.gitee.io/categories/%E6%95%B0%E6%8D%AE%E5%BA%93/" class="category-list-link">数据库</a><span class="category-list-count">15</span></li>
        </ul>
    </div>
</div>
      <div class="widget">
    <h3 class="widget-title"> Tags</h3>
    <div class="widget-body">
        <ul class="tag-list">
            
            
            <li class="tag-list-item"><a href="https://rulerLwx.gitee.io/tags/jvm/" class="tag-list-link">jvm</a><span
                    class="tag-list-count">1</span></li>
            
            
            <li class="tag-list-item"><a href="https://rulerLwx.gitee.io/tags/%E5%A4%9A%E7%BA%BF%E7%A8%8B/" class="tag-list-link">多线程</a><span
                    class="tag-list-count">2</span></li>
            
            
            <li class="tag-list-item"><a href="https://rulerLwx.gitee.io/tags/%E7%BD%91%E7%BB%9C%E7%BC%96%E7%A8%8B/" class="tag-list-link">网络编程</a><span
                    class="tag-list-count">3</span></li>
            
        </ul>

    </div>
</div>
      
<div class="widget">
    <h3 class="widget-title">Recent Posts</h3>
    <div class="widget-body">
        <ul class="recent-post-list list-unstyled no-thumbnail">
            <li>
                <div class="item-inner">
                    <p class="item-title">
                        <a href="https://rulerLwx.gitee.io/2020/07/%E8%87%AA%E5%B7%B1%E5%8A%A8%E6%89%8B%E4%B8%80%E6%89%B9%E9%87%8F%E7%A7%BB%E5%8A%A8%E9%87%8D%E5%91%BD%E5%90%8D%E6%96%87%E4%BB%B6/" class="title">自己动手（一）——批量移动、重命名文件</a>
                    </p>
                    <p class="item-date">
                        <time datetime="2020-07-27 17:50:02 &#43;0800 CST" itemprop="datePublished">2020-07-27</time>
                    </p>
                </div>
            </li>
            <li>
                <div class="item-inner">
                    <p class="item-title">
                        <a href="https://rulerLwx.gitee.io/2020/07/%E5%85%B3%E4%BA%8Einteger%E7%9A%84-128~127%E7%BC%93%E5%AD%98/" class="title">关于Integer的 -128~127缓存</a>
                    </p>
                    <p class="item-date">
                        <time datetime="2020-07-11 16:56:21 &#43;0800 CST" itemprop="datePublished">2020-07-11</time>
                    </p>
                </div>
            </li>
            <li>
                <div class="item-inner">
                    <p class="item-title">
                        <a href="https://rulerLwx.gitee.io/2020/07/%E8%B7%A8%E5%9F%9F%E9%97%AE%E9%A2%98/" class="title">跨域问题</a>
                    </p>
                    <p class="item-date">
                        <time datetime="2020-07-08 22:41:12 &#43;0800 CST" itemprop="datePublished">2020-07-08</time>
                    </p>
                </div>
            </li>
            <li>
                <div class="item-inner">
                    <p class="item-title">
                        <a href="https://rulerLwx.gitee.io/2020/07/%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2%E6%90%AD%E5%BB%BA/" class="title">个人博客搭建</a>
                    </p>
                    <p class="item-date">
                        <time datetime="2020-07-05 18:58:47 &#43;0800 CST" itemprop="datePublished">2020-07-05</time>
                    </p>
                </div>
            </li>
            <li>
                <div class="item-inner">
                    <p class="item-title">
                        <a href="https://rulerLwx.gitee.io/2020/07/mongodb-1/" class="title">MonggoDB-1</a>
                    </p>
                    <p class="item-date">
                        <time datetime="2020-07-03 18:58:47 &#43;0800 CST" itemprop="datePublished">2020-07-03</time>
                    </p>
                </div>
            </li>
        </ul>
    </div>
</div>
  </div>
</aside>

    
    
<aside class="sidebar sidebar-toc collapse" id="collapseToc" itemscope itemtype="http://schema.org/WPSideBar">
  <div class="slimContent">
    <h4 class="toc-title">Catalogue</h4>
    <nav id="toc" class="js-toc toc">

    </nav>
  </div>
</aside>
<main class="main" role="main"><div class="content">
  <article id="-" class="article article-type-" itemscope
    itemtype="http://schema.org/BlogPosting">
    
    <div class="article-header">
      <h1 itemprop="name">
  <a
    class="article-title"
    href="/2017/08/docker-1-%E5%9F%BA%E7%A1%80/"
    >Docker-1-基础</a
  >
</h1>

      <div class="article-meta">
        
<span class="article-date">
  <i class="icon icon-calendar-check"></i>&nbsp;
<a href="https://rulerLwx.gitee.io/2017/08/docker-1-%E5%9F%BA%E7%A1%80/" class="article-date">
  <time datetime="2017-08-01 10:02:01 &#43;0800 CST" itemprop="datePublished">2017-08-01</time>
</a>
</span>
<span class="article-category">
  <i class="icon icon-folder"></i>&nbsp;
  <a class="article-category-link" href="/categories/linux/"> Linux </a>
</span>  
  <span class="article-tag">
    <i class="icon icon-tags"></i>&nbsp;
    <a class="article-tag-link" href="/tags//">  </a>
  </span>

        <span class="post-comment"><i class="icon icon-comment"></i>&nbsp;<a href="/2017/08/docker-1-%E5%9F%BA%E7%A1%80/#comments"
            class="article-comment-link">Comments</a></span>
		<span class="post-wordcount hidden-xs" itemprop="wordCount">Word Count: 5365words</span>
		<span class="post-readcount hidden-xs" itemprop="timeRequired">Read Count: 11minutes </span>
      </div>
    </div>
    <div class="article-entry marked-body js-toc-content" itemprop="articleBody">
      <h1 id="什么是docker">什么是Docker？</h1>
<p>官网：https://www.docker.com/</p>
<p>开源：https://github.com/docker</p>
<p>Docker是一个开源的应用容器引擎，支持将软件编译成一个镜像，然后在镜像中各种做好配置，将镜像发布出去，其它使用者直接使用这个镜像。容器启动是非常讯速的。类似windows里面的ghost操作系统，安装好后什么都有了。</p>
<p><img src="https://gitee.com/rulerLwx/PicGo/raw/master/img-07/20200708161745.png" alt=""></p>
<h2 id="docker核心概念">Docker核心概念</h2>
<p>Docker核心概念：</p>
<ul>
<li>docker主机（Host）：一个物理或虚拟的机器用于执行Docker守护进程和容器（安装了Docker程序的机器，可以是Linux或windows）</li>
<li>docker客户端（Client）：客户端通过命令或其它工具使用Docker API（）与Docker的守护进程通信</li>
<li>docker仓库（Registry）：用来保存打包好的镜像，可以理解为代码控制中的代码仓库。Docker Hub（https://hub.docker.com）提供了庞大的镜像集合供使用。</li>
<li>docker镜像（Images）：用于创建Docker容器的模板</li>
<li>docker容器（Container）：镜像启动后的实例称为一个容器；容器是一个独立运行的一个或一组应用</li>
</ul>
<p><img src="https://gitee.com/rulerLwx/PicGo/raw/master/img-07/20200708161843.png" alt=""></p>
<p>Docker使用步骤：</p>
<p>1）安装Docker</p>
<p>2）去Docker仓库找到这个软件对应的镜像</p>
<p>3）使用Docker运行这个镜像，这个镜像就会生成一个Docker容器</p>
<p>4）对容器的启动停止就是对软件的启动停止</p>
<h2 id="安装dockerlinux">安装Docker（Linux）</h2>
<p>1）环境：CentOS7、</p>
<p>Docker要求CentOS内核版本高于3.10，如果版本过低，可以用<code>yum update</code>升级内核版本</p>
<p>2）安装</p>
<pre><code class="language-shell">yum update #更新内核到3.10以上

yum install docker

systemctl start docker #启动docker

systemctl enable/disable docker #设为/关闭开机启动

systemctl stop docker #停止docker
</code></pre>
<p>启动失败</p>
<p><img src="https://gitee.com/rulerLwx/PicGo/raw/master/img-07/20200708161941.png" alt=""></p>
<p>解决办法：<code>vim /etc/sysconfig/docker</code>，设置<code>--selinux-enabled=false</code></p>
<p><img src="https://gitee.com/rulerLwx/PicGo/raw/master/img-07/20200708161957.png" alt=""></p>
<p>参考了：https://blog.csdn.net/kavito/article/details/81200665</p>
<p>总结：将centos7的内核升级至最新后再安装docker可以减少很多错误，另外还需要禁用sell linux。</p>
<pre><code class="language-shell">[root@eureka1 test]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.

</code></pre>
<p>peter老师：3423941094</p>
<h2 id="安装dockerwindows">安装Docker（Windows）</h2>
<pre><code>Docker Desktop requires Windows 10 Pro or Enterprise version 14393 to run.
</code></pre>
<h1 id="常用操作">常用操作</h1>
<h2 id="一镜像操作">一、镜像操作</h2>
<table>
<thead>
<tr>
<th>操作</th>
<th>命令</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>检索</td>
<td>docker search xxx，如：docker search redis</td>
<td>检索镜像，作用不大，还不如到官网上检索 <a href="https://hub.docker.com/">https://hub.docker.com/</a></td>
</tr>
<tr>
<td>拉取</td>
<td>docker pull 镜像名:tag</td>
<td>:tag是可选的，tag表示标签，多为软件版本，默认为latest</td>
</tr>
<tr>
<td>列表</td>
<td>docker images</td>
<td>查看所有本地镜像</td>
</tr>
<tr>
<td>删除</td>
<td>docker rmi image-id</td>
<td>删除指定的本地镜像</td>
</tr>
<tr>
<td>清理镜像</td>
<td>docker image prune</td>
<td>清除一些遗留的临时镜像，释放空间</td>
</tr>
</tbody>
</table>
<ul>
<li>| docker commit  -m=&quot;提交的描述信息&rdquo; -a=&quot;作者&rdquo; 容器ID 要创建的目标镜像名:[TAG] | 提交容器副本使之成为一个新的镜像</li>
</ul>
<p>怎么知道有哪些可用的tag?官网上搜索会提示有哪些可用的tags <a href="https://hub.docker.com/">https://hub.docker.com/</a></p>
<hr>
<p>解决镜像下载慢的问题：</p>
<p>1）登录阿里云 <a href="https://www.aliyun.com/">https://www.aliyun.com/</a> ，查看镜像加速地址：https://chohcg90.mirror.aliyuncs.com</p>
<p><img src="https://gitee.com/rulerLwx/PicGo/raw/master/img-07/20200708162036.png" alt=""></p>
<p>2）<code>vim /etc/docker/daemon.json</code>，修改如下：</p>
<pre><code>{
&quot;registry-mirrors&quot;: [&quot;https://chohcg90.mirror.aliyuncs.com&quot;]
}
</code></pre>
<p>参考：https://www.cnblogs.com/kevin7234/p/10617734.html</p>
<hr>
<p>将镜像提交到阿里云</p>
<p>1）登录阿里云，创建镜像仓库</p>
<p>2）本地上传镜像到刚刚创建的镜像仓库</p>
<p>创建镜像仓库后，上面有文档参考</p>
<h2 id="二容器操作">二、容器操作</h2>
<p>软件镜像（QQ安装程序）&mdash;》运行镜像&mdash;》产生一个容器（正在运行的QQ）</p>
<table>
<thead>
<tr>
<th>操作</th>
<th>命令</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>运行</td>
<td>docker run &ndash;name container-name -d image-name <!-- raw HTML omitted --> 如：docker run -name myredis -d redis</td>
<td>&ndash;name：自定义容器名 <!-- raw HTML omitted --> -d：后台运行 <!-- raw HTML omitted --> image-name：指定镜像模板</td>
</tr>
<tr>
<td>列表</td>
<td>docker ps（查看运行中的容器）</td>
<td>docker ps -a 可以查看所有容器</td>
</tr>
<tr>
<td>停止</td>
<td>docker stop/kill container-name/container-id</td>
<td>停止当前运行的容器</td>
</tr>
<tr>
<td>启动</td>
<td>docker start/restart container-name/container-id</td>
<td>启动容器</td>
</tr>
<tr>
<td>删除</td>
<td>docker rm container-id <!-- raw HTML omitted --> docker rm -f $(docker ps -q) 删除全部在运行的容器 <!-- raw HTML omitted --> docker rm -f $(docker ps -a -q) 删除所有容器</td>
<td>删除指定的容器</td>
</tr>
<tr>
<td>端口映射</td>
<td>-p 6379:6379 <!-- raw HTML omitted --> 如：docker run -d -p 6379:6379 &ndash;name myredis redis</td>
<td>-p：主机端口（映射到）容器内部的端口</td>
</tr>
<tr>
<td>容器日志</td>
<td>docker logs container-name/container-id [OPTIONS]</td>
<td>-t 加入时间戳 <!-- raw HTML omitted --> -f 跟随最新的日志打印 <!-- raw HTML omitted --> &ndash;tail x(x是数字) 显示最后多少行</td>
</tr>
<tr>
<td>查看容器内运行的进程</td>
<td>docker top 容器id</td>
<td></td>
</tr>
<tr>
<td>查看容器内部细节</td>
<td>docker inspect 容器id</td>
<td>查看容器的内部细节，包括IP、网桥</td>
</tr>
<tr>
<td>进入正在运行的容器 <!-- raw HTML omitted --> 并以命令行交互</td>
<td>docker exec -it 容器ID bashShell <!-- raw HTML omitted --> <code>docker container exec -it nginx1 /bin/bash</code> <!-- raw HTML omitted --> docker attach 容器ID</td>
<td>区别：<!-- raw HTML omitted --> attach 直接以命令交互方式进入容器 <!-- raw HTML omitted --> exec 不用进入容器却能执行容器的命令</td>
</tr>
<tr>
<td>从容器拷贝文件到主机上</td>
<td>docker cp 容器ID:容器内路径 目标主机路径</td>
<td></td>
</tr>
<tr>
<td>更多命令</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<hr>
<p>容器启动命令 docker run，格式：docker run [OPTIONS] IMAGE [COMMAND] [ARG&hellip;]</p>
<p>OPTIONS，有些是一个减号，有些是两个减号</p>
<ul>
<li>
<p>&ndash;name = &ldquo;给容器起个名字&rdquo;</p>
</li>
<li>
<p>-d 后台运行，并返回容器ID</p>
</li>
<li>
<p>-i 以交互模式运行容器，通常与 -t 同时使用</p>
</li>
<li>
<p>-t 为容器重新分配一个伪输入终端，通常与 -i 同时使用</p>
</li>
<li>
<p>-P 随机端口映射</p>
</li>
<li>
<p>-p 指定端口映射</p>
<ul>
<li>ip:hostPort:containerPort</li>
<li>ip::containerPort</li>
<li>hostPort:containerPort，这个常用</li>
<li>containerPort</li>
</ul>
</li>
</ul>
<p>例如在docker上启动ctntos</p>
<pre><code class="language-shell">docker run -it 9f38484d220f
</code></pre>
<p>退出centos</p>
<ul>
<li>exit，完全退出并关闭容器</li>
<li>快捷键：ctrl + P + Q，暂时退出但不关闭容器</li>
</ul>
<p>重新进入centos</p>
<ul>
<li>方式一：</li>
</ul>
<pre><code class="language-shell">docker exec -t 容器ID /bin/bash
</code></pre>
<ul>
<li>方式二：</li>
</ul>
<pre><code class="language-shell">docker attach 容器ID
</code></pre>
<p><code>docker exec -t 容器ID ls -l /tmp</code>可以直接执行容器中的命令而不用进入容器中的命令行界面，“隔山打牛”。</p>
<hr>
<p>docker ps [OPTIONS]</p>
<ul>
<li>-a 所有历史记录的容器</li>
<li>-l 上一次打开的容器</li>
<li>-n x(x是数字)，最近打开过的x个容器</li>
<li>-q 查出正在运行的容器ID，批量删除容器：docker rm -f $(docker ps -q) ——20190704</li>
</ul>
<h2 id="文件拷贝">文件拷贝</h2>
<ul>
<li>从宿主机拷贝文件到容器中：docker cp 需要拷贝的文件或目录 容器名称:容器目录</li>
<li>从容器拷贝文件到宿主机中：docker cp 容器名称:容器目录 宿主机目录</li>
</ul>
<h2 id="目录挂载">目录挂载</h2>
<p>-v 参数</p>
<p>目录挂载是为了方便在宿主机编辑文件，然后会同步到容器上，程序运行，最终是按容器中的目录 ——20191031</p>
<h1 id="镜像原理">镜像原理</h1>
<p>这是金鱼背上的一个集装箱</p>
<p><img src="https://gitee.com/rulerLwx/PicGo/raw/master/img-07/20200708162120.png" alt=""></p>
<p>相关概念：</p>
<ul>
<li>UnionFS（联合文件系统）</li>
<li>bootfs，</li>
<li>rootfs，在bootfs之上，包含的就是典型的Linux中的/dev,/proc,/bin,/etc等标准目录和文件，rootfs就是各种不同的操作系统发行版本，如ubuntu、centos。</li>
</ul>
<p><img src="https://gitee.com/rulerLwx/PicGo/raw/master/img-07/20200708162143.png" alt=""></p>
<h1 id="数据卷">数据卷</h1>
<p>数据卷：对容器数据的持久化，持久化到主机上，容器与主机之间的数据共享。</p>
<h2 id="-v-参数">-v 参数</h2>
<p>命令：</p>
<pre><code>docker run -it -v /宿主机绝对路径目录:/容器内目录 镜像名或id
</code></pre>
<p>命令（带权限）</p>
<pre><code>docker run -it -v /宿主机绝对路径目录:/容器内目录:ro 镜像名或id
</code></pre>
<ul>
<li>默认是可读可写</li>
<li>:ro 只读，容器只能读，主机可读可写</li>
</ul>
<p>总结：<code>-v</code>除了目录映射外，还可以文件映射，即：-v /宿主机绝对路径文件:/容器内的文件，如nginx.conf ——20191121</p>
<h2 id="dockerfile">DockerFile</h2>
<p>1）在主机根目录下新建mydocker目录并进入</p>
<pre><code class="language-shell"># cd /
# mkdir /mydocker
# cd /mydocker/
</code></pre>
<p>2）在Dockerfile中使用 VOLUME 指令来给镜像添加一个或多个数据卷</p>
<pre><code class="language-shell"># vim DockerFile
</code></pre>
<p>内容如下：</p>
<pre><code class="language-shell">FROM centos
VOLUME [&quot;/dataVolumeContainer1&quot;,&quot;/dataVolumeContainer2&quot;]
CMD echo &quot;finished,-----------success1&quot;
CMD /bin/bash
</code></pre>
<p>3）build生成新的镜像</p>
<pre><code class="language-shell"># docker build -f /mydocker/DockerFile -t zzyy/centos .
</code></pre>
<p>4）运行刚刚生成的容器容器</p>
<pre><code class="language-shell"># docker run -it zzyy/centos
</code></pre>
<p>在根目录下可以看到多个两个卷</p>
<p><img src="https://gitee.com/rulerLwx/PicGo/raw/master/img-07/20200708162206.png" alt=""></p>
<p>5）备注</p>
<p>如果出现容器卷不能写，出现cannot open directory:Permission denied</p>
<p>解决办法：在挂载目录后多加一个 &ndash;privileged=true 参数</p>
<h1 id="容器数据卷">容器数据卷</h1>
<h2 id="是什么">是什么</h2>
<p>命名的容器挂载数据卷，其它容器通过容器通过挂载这个（父容器）实现数据共享，挂载数据卷的容器称之为数据卷容器。</p>
<p>一句话：活动硬盘上挂活动硬盘，实现数据的传递依赖。</p>
<h2 id="数据共享">数据共享</h2>
<p>上面已经创建了一个 zzyy/centos 镜像，并且有了两个数据卷 dataVolumeContainer1、dataVolumeContainer2</p>
<pre><code class="language-shell">[root@localhost ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
zzyy/centos         latest              e8c61129663a        9 hours ago         202 MB
...

[root@localhost ~]# docker run -it --name dc01 zzyy/centos
[root@3da5bea8d5d8 /]# ll
total 12
-rw-r--r--.   1 root root 12082 Mar  5 17:36 anaconda-post.log
lrwxrwxrwx.   1 root root     7 Mar  5 17:34 bin -&gt; usr/bin
drwxr-xr-x.   2 root root     6 Jul  4 16:19 dataVolumeContainer1
drwxr-xr-x.   2 root root     6 Jul  4 16:19 dataVolumeContainer2
drwxr-xr-x.   5 root root   360 Jul  4 16:19 dev
drwxr-xr-x.   1 root root    66 Jul  4 16:19 etc
...
[root@3da5bea8d5d8 /]# cd dataVolumeContainer2/                     // 在这个容器的这个目录，创建一个文件
[root@3da5bea8d5d8 dataVolumeContainer2]# touch dc01_add.txt

ctrl + p + q

[root@localhost ~]# docker run -it --name dc02 --volumes-from dc01 zzyy/centos
[root@61be3fe9262b /]# ll
total 12
-rw-r--r--.   1 root root 12082 Mar  5 17:36 anaconda-post.log
lrwxrwxrwx.   1 root root     7 Mar  5 17:34 bin -&gt; usr/bin
drwxr-xr-x.   2 root root     6 Jul  4 16:19 dataVolumeContainer1
drwxr-xr-x.   2 root root    26 Jul  4 16:20 dataVolumeContainer2
drwxr-xr-x.   5 root root   360 Jul  4 16:28 dev
...
[root@61be3fe9262b /]# cd dataVolumeContainer2
[root@61be3fe9262b dataVolumeContainer2]# ll
total 0
-rw-r--r--. 1 root root 0 Jul  4 16:20 dc01_add.txt                 // 这个文件是从 dc01容器继承过来的
[root@61be3fe9262b dataVolumeContainer2]# 
[root@61be3fe9262b dataVolumeContainer2]# touch dc02_add.txt

ctrl + p + q

[root@localhost ~]# docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
61be3fe9262b        zzyy/centos         &quot;/bin/sh -c /bin/bash&quot;   11 minutes ago      Up 11 minutes                           dc02
3da5bea8d5d8        zzyy/centos         &quot;/bin/sh -c /bin/bash&quot;   19 minutes ago      Up 19 minutes                           dc01

[root@localhost ~]# docker run -it --name dc03 --volumes-from dc01 zzyy/centos
[root@d541e9e3b6a2 /]# cd dataVolumeContainer2
[root@d541e9e3b6a2 dataVolumeContainer2]# ll
total 0
-rw-r--r--. 1 root root 0 Jul  4 16:20 dc01_add.txt
-rw-r--r--. 1 root root 0 Jul  4 16:38 dc02_add.txt                 // 也有前两个容器的文件
[root@d541e9e3b6a2 dataVolumeContainer2]# 
[root@d541e9e3b6a2 dataVolumeContainer2]# touch dc03_add.txt

ctrl + p + q

[root@localhost ~]# docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
d541e9e3b6a2        zzyy/centos         &quot;/bin/sh -c /bin/bash&quot;   5 minutes ago       Up 5 minutes                            dc03
61be3fe9262b        zzyy/centos         &quot;/bin/sh -c /bin/bash&quot;   19 minutes ago      Up 19 minutes                           dc02
3da5bea8d5d8        zzyy/centos         &quot;/bin/sh -c /bin/bash&quot;   28 minutes ago      Up 28 minutes                           dc01
[root@localhost ~]# docker attach dc01
[root@3da5bea8d5d8 dataVolumeContainer2]# ll
total 0
-rw-r--r--. 1 root root 0 Jul  4 16:20 dc01_add.txt
-rw-r--r--. 1 root root 0 Jul  4 16:38 dc02_add.txt
-rw-r--r--. 1 root root 0 Jul  4 16:47 dc03_add.txt                 // dc01容器有子容器添加的文件
[root@3da5bea8d5d8 dataVolumeContainer2]# 

</code></pre>
<p>整理：dc02、dc03的父类都是dc01，子到父，父到子都可以传递文件。</p>
<p>如果此时将父容器dc01删掉，dc02和dc03之间数据还是共享的，也就是文件是共享的，数据卷的生命周期一直持续到没有容器使用它为止。</p>
<h1 id="dockerfile-1">DockerFile</h1>
<h2 id="是什么-1">是什么</h2>
<p>Dockerfile是用来构建Docker镜像的构建文件，是由一系列命令、参数构成的脚本。</p>
<p>三个步骤</p>
<p>1）编写DockerFile文件</p>
<p>2）docker build</p>
<p>3）docker run</p>
<p>文件长什么样子的？以centos6.8为例</p>
<pre><code class="language-dockerfile">FROM scratch
MAINTAINER The CentOS Project &lt;cloud-ops@centos.org&gt;
ADD c68-docker.tar.xz /
LABEL name=&quot;CentOS Base Image&quot; \
    vendor=&quot;CentOS&quot; \
    license=&quot;GPLv2&quot; \
    build-date=&quot;2016-06-02&quot;

# Default command
CMD [&quot;/bin/bash&quot;]
</code></pre>
<h2 id="构建过程解析">构建过程解析</h2>
<p>DockerFile内容基础知识：</p>
<ul>
<li>每条保留字指令都必须为大写字母且后面跟随至少一个参数</li>
<li>指令按照从上到下顺序执行</li>
<li>#表示注解</li>
<li>每条指令都会创建一个新的镜像层，并对镜像进行提交</li>
</ul>
<p>执行大致流程</p>
<ol>
<li>从基础镜像运行一个容器</li>
<li>执行一条指令并对容器作出修改</li>
<li>执行 docker commit 提交一个新的镜像层</li>
<li>基于刚刚提交的镜像运行一个新的容器</li>
<li>执行下一条指令直至所有指令都执行完成</li>
</ol>
<p><img src="https://gitee.com/rulerLwx/PicGo/raw/master/img-07/20200708162249.png" alt=""></p>
<h2 id="体系结构保留字指令">体系结构（保留字指令）</h2>
<ul>
<li>FROM</li>
<li>MAINTAINER</li>
<li>RUN</li>
<li>EXPOSE</li>
<li>WORKDIR</li>
<li>ENV</li>
<li>ADD</li>
<li>COPY</li>
<li>VOLUME</li>
<li>CMD</li>
<li>ENTRYPOINT</li>
<li>ONBUILD</li>
</ul>
<p>解释</p>
<ul>
<li>FROM，基础镜像，当前镜像是基于哪个镜像的</li>
<li>MAINTAINER，镜像维护者的姓名、邮箱</li>
<li>RUN，容器构建时需要执行的命令</li>
<li>EXPOSE，当前容器对外暴露的端口</li>
<li>WORKDIR，指定在容器创建后，终端默认登录进来的工作目录，落脚点</li>
<li>ENV，用来在构建镜像过程中设置环境变量，定义变量后，后面的指令就可以使用$来获取定义的变量</li>
</ul>
<pre><code class="language-dockerfile">ENV MY_PATH /usr/mytest
...
WORKDIR $MY_PATH
</code></pre>
<ul>
<li>ADD，将宿主机目录下的文件拷贝进镜像且ADD命令会自动处理URL和解压tar压缩包</li>
<li>COPY，类似ADD，只是拷贝，从&lt;源路径&gt;拷贝到&lt;目标路径&gt;
<ul>
<li>COPY src dest</li>
<li>COPY [&ldquo;src&rdquo;,&ldquo;dest&rdquo;]</li>
</ul>
</li>
<li>VOLUME，容器数据卷，用于数据保存、待久化，VOLUME [&quot;/dataVolumeContainer1&rdquo;,&quot;/dataVolumeContainer2&rdquo;]</li>
<li>CMD，指定一个容器启动时运行的命令，可以有多个CMD命令，但只有最后一个生效，CMD会被 docker run 之后的参数替换</li>
<li>ENTRYPOINT，指定一个容器启动时运行的命令，跟CMD一样，都是在指定容器启动程序及参数，区别是：CMD命令可能被替换，而ENTRYPOINT可以追加命令</li>
<li>ONBUILD，在构建一个被继承的DockerFile时运行命令，父镜像在被子继承后父镜像的onbuild被触发</li>
</ul>
<h2 id="案例">案例</h2>
<h3 id="自定义mycentos">自定义mycentos</h3>
<p>让精简版的centos具有以下功能：</p>
<ol>
<li>登录后的默认路径</li>
<li>vim编辑器</li>
<li>支持ifconfig查看网络</li>
</ol>
<p>步骤：</p>
<p>1）在宿主机根目录下的mydocker目录下创建一个DockerFile</p>
<pre><code class="language-shell">cd /
cd /mydocker
vim DockerFile2
</code></pre>
<p>内容如下：</p>
<pre><code class="language-dockerfile">FROM centos
MAINTAINER zzyy&lt;zzyy167@126.com&gt;

ENV MYPATH /usr/local
WORKDIR $MYPATH

RUN yum -y install vim
RUN yum -y install net-tools

EXPOSE 80

CMD echo $MYPATH
CMD echo &quot;success......ok&quot;
CMD /bin/bash
</code></pre>
<p>2）构建</p>
<pre><code class="language-shell">docker build -f /mydocker/DockerFile2 -t mycentos:1.3 .
</code></pre>
<p>注意：最后有个点<code>.</code>代表当前路径</p>
<p>3）运行</p>
<pre><code class="language-shell">docker run -it mycentos:1.3
</code></pre>
<p>默认进入 /usr/local 目录，也能使用 vim/ifconfig 命令了</p>
<p>4）列出镜像变更历史</p>
<pre><code class="language-shell">docker history 镜像ID

docker history 8911244c3084
</code></pre>
<h3 id="cmdentrypoint命令案例">CMD/ENTRYPOINT命令案例</h3>
<p>cmd/entrypoint都是指定一个容器启动时运行的命令</p>
<p>区别：</p>
<ul>
<li>CMD，指定一个容器启动时运行的命令，可以有多个CMD命令，但只有最后一个生效，CMD会被 docker run 之后的参数替换</li>
<li>ENTRYPOINT，指定一个容器启动时运行的命令，跟CMD一样，都是在指定容器启动程序及参数，区别是：CMD命令可能被替换，而ENTRYPOINT可以追加命令</li>
</ul>
<h3 id="自定义的tomcat9">自定义的tomcat9</h3>
<p>dockerfile</p>
<pre><code class="language-shell">FROM         centos
MAINTAINER    zzyy&lt;zzyybs@126.com&gt;
#把宿主机当前上下文的c.txt拷贝到容器/usr/local/路径下
COPY c.txt /usr/local/cincontainer.txt
#把java与tomcat添加到容器中
ADD jdk-8u171-linux-x64.tar.gz /usr/local/
ADD apache-tomcat-9.0.8.tar.gz /usr/local/
#安装vim编辑器
RUN yum -y install vim
#设置工作访问时候的WORKDIR路径，登录落脚点
ENV MYPATH /usr/local
WORKDIR $MYPATH
#配置java与tomcat环境变量
ENV JAVA_HOME /usr/local/jdk1.8.0_171
ENV CLASSPATH $JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
ENV CATALINA_HOME /usr/local/apache-tomcat-9.0.8
ENV CATALINA_BASE /usr/local/apache-tomcat-9.0.8
ENV PATH $PATH:$JAVA_HOME/bin:$CATALINA_HOME/lib:$CATALINA_HOME/bin
#容器运行时监听的端口
EXPOSE  8080
#启动时运行tomcat
# ENTRYPOINT [&quot;/usr/local/apache-tomcat-9.0.8/bin/startup.sh&quot; ]
# CMD [&quot;/usr/local/apache-tomcat-9.0.8/bin/catalina.sh&quot;,&quot;run&quot;]
CMD /usr/local/apache-tomcat-9.0.8/bin/startup.sh &amp;&amp; tail -F /usr/local/apache-tomcat-9.0.8/bin/logs/catalina.out
</code></pre>
<p>启动命令：<code># docker run --name centos_jdk_tomcat -p 8080:8080 -d  centos_jdk_tomcat</code></p>
<p>注意：</p>
<ul>
<li>此处需以压缩包方式上传，<code>ADD jdk-8u171-linux-x64.tar.gz /usr/local/</code>，否则出现启动文件找不到问题</li>
<li>如果文件夹方式，<code>ADD jdk1.8.0_251 /usr/local/</code>，则其复制是<code>jdk1.8.0_251文件夹下</code>的文件，而不是<code>jdk1.8.0_251及其目录下</code>的文件</li>
</ul>
<h1 id="faq">FAQ</h1>
<h2 id="docker容器开机自动启动">Docker容器开机自动启动</h2>
<p>在使用docker run启动容器时，使用&ndash;restart参数来设置：</p>
<pre><code class="language-shell"># docker run -m 512m --memory-swap 1G -it -p 58080:8080 --restart=always --name bvrfis --volumes-from logdata mytomcat:4.0 /root/run.sh 
</code></pre>
<p>&ndash;restart具体参数值详细信息：</p>
<ul>
<li>no -  容器退出时，不重启容器；</li>
<li>on-failure - 只有在非0状态退出时才从新启动容器；</li>
<li>always - 无论退出状态是如何，都重启容器；</li>
</ul>
<p>参考：https://blog.csdn.net/menghuanbeike/article/details/79261828</p>
<h1 id="附件">附件</h1>
<h2 id="docker相关书">Docker相关书</h2>
<p><a href="https://blog.csdn.net/qq_40083727/article/details/88676382">https://blog.csdn.net/qq_40083727/article/details/88676382</a></p>
<p><a href="https://blog.csdn.net/icannotdebug/article/details/82352825">https://blog.csdn.net/icannotdebug/article/details/82352825</a></p>

    </div>
    <div class="article-footer">
<blockquote class="mt-2x">
  <ul class="post-copyright list-unstyled">
    <li class="post-copyright-link hidden-xs">
      <strong>Permalink: </strong>
      <a href="https://rulerLwx.gitee.io/2017/08/docker-1-%E5%9F%BA%E7%A1%80/" title="Docker-1-基础" target="_blank" rel="external">https://rulerLwx.gitee.io/2017/08/docker-1-%E5%9F%BA%E7%A1%80/</a>
    </li>
    <li class="post-copyright-license">
      <strong>License：</strong><a href="http://creativecommons.org/licenses/by/4.0/deed.zh" target="_blank" rel="external">CC BY 4.0 CN</a>
    </li>
  </ul>
</blockquote>

<div class="panel panel-default panel-badger">
  <div class="panel-body">
    <figure class="media">
      <div class="media-left">
        <a href="https://gitee.com/rulerLwx" target="_blank" class="img-burn thumb-sm visible-lg">
          <img src="https://rulerLwx.gitee.io/avatar.png" class="img-rounded w-full" alt="">
        </a>
      </div>
      <div class="media-body">
        <h3 class="media-heading"><a href="https://gitee.com/rulerLwx" target="_blank"><span class="text-dark">rulerLwx</span><small class="ml-1x">thinking...</small></a></h3>
        <div>Good Good Study, Day Day Up~</div>
      </div>
    </figure>
  </div>
</div>
    </div>
  </article>
<section id="comments">
    <div id="vcomments"></div>
</section>

</div><nav class="bar bar-footer clearfix" data-stick-bottom>
    <div class="bar-inner">
        <ul class="pager pull-left">
            <li class="prev">
                <a href="https://rulerLwx.gitee.io/2017/08/centos-%E5%B8%B8%E7%94%A8%E8%BD%AF%E4%BB%B6%E5%AE%89%E8%A3%85/" title="CentOS-常用软件安装"><i
                        class="icon icon-angle-left"
                        aria-hidden="true"></i><span>&nbsp;&nbsp;Older</span></a>
            </li>
            <li class="next">
                <a href="https://rulerLwx.gitee.io/2017/08/nginx-1-%E5%9F%BA%E7%A1%80/"
                    title="Nginx-1"><span>Newer&nbsp;&nbsp;</span><i
                        class="icon icon-angle-right" aria-hidden="true"></i></a>
            </li>
            
            <li class="toggle-toc">
                <a class="toggle-btn collapsed" data-toggle="collapse" href="#collapseToc" aria-expanded="false"
                    title="Catalogue" role="button">
                    <span>[&nbsp;</span><span>Catalogue</span>
                    <i class="text-collapsed icon icon-anchor"></i>
                    <i class="text-in icon icon-close"></i>
                    <span>]</span>
                </a>
            </li>
        </ul>
        <div class="bar-right">
            <div class="share-component" data-sites="weibo,qq,wechat"
                data-mobile-sites="weibo,qq,qzone"></div>
        </div>
    </div>
</nav>

</main><footer class="footer" itemscope itemtype="http://schema.org/WPFooter">
<ul class="social-links">
    <li><a href="https://gitee.com/rulerLwx" target="_blank" title="gitee" data-toggle=tooltip data-placement=top >
            <i class="icon icon-gitee"></i></a></li>
    <li><a href="https://github.com/wolf-lea" target="_blank" title="github" data-toggle=tooltip data-placement=top >
            <i class="icon icon-github"></i></a></li>
</ul>
  <div class="copyright">
    &copy;2017  -
    2020
    <div class="publishby">
        Theme by <a href="https://github.com/xiaoheiAh" target="_blank"> xiaoheiAh </a>base on<a href="https://github.com/xiaoheiAh/hugo-theme-pure" target="_blank"> pure</a>.
    </div>
  </div>
</footer>

<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_SVG"></script>
<script type="text/x-mathjax-config">
    MathJax.Hub.Config({
            showMathMenu: false, //disables context menu
            tex2jax: {
            inlineMath: [ ['$','$'], ['\\(','\\)'] ]
           }
    });
</script>


<script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"></script>
<script>
    window.jQuery || document.write('<script src="js/jquery.min.js"><\/script>')
</script>
<script type="text/javascript" src="https://cdn.staticfile.org/highlight.js/9.15.10/highlight.min.js"></script>
<script type="text/javascript" src="https://cdn.staticfile.org/highlight.js/9.15.10/languages/python.min.js" defer></script>
<script type="text/javascript" src="https://cdn.staticfile.org/highlight.js/9.15.10/languages/javascript.min.js" defer></script><script>
    hljs.configure({
        tabReplace: '    ', 
        classPrefix: ''     
        
    })
    hljs.initHighlightingOnLoad();
</script>
<script src="https://rulerLwx.gitee.io/js/application.min.bdeb64b910570b6c41badc6a05b7afb0c8ad9efd8525de3c7257d59e786326a3.js"></script>
<script src="https://rulerLwx.gitee.io/js/plugin.min.51ff8c7317566f82259170fa36e09c4493adc9b9378b427a01ad3f017ebac7dd.js"></script>

<script>
    (function (window) {
        var INSIGHT_CONFIG = {
            TRANSLATION: {
                POSTS: 'Posts',
                PAGES: 'Pages',
                CATEGORIES: 'Categories',
                TAGS: 'Tags',
                UNTITLED: '(Untitled)',
            },
            ROOT_URL: 'https:\/\/rulerLwx.gitee.io',
            CONTENT_URL: 'https:\/\/rulerLwx.gitee.io\/searchindex.json ',
        };
        window.INSIGHT_CONFIG = INSIGHT_CONFIG;
    })(window);
</script>
<script type="text/javascript" src="https://rulerLwx.gitee.io/js/insight.min.a343cd9a5a7698336b28ef3a7c16a3a1b1d2d5fb17dc8ed04022bbe08cc5459073a15bdafa3a8a58cdd56080784bdd69fa70b1ae8597565c799c57ed00f0e120.js" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.4.2/tocbot.min.js"></script>
<script>
    tocbot.init({
        
        tocSelector: '.js-toc',
        
        contentSelector: '.js-toc-content',
        
        headingSelector: 'h1, h2, h3',
        
        hasInnerContainers: true,
    });
</script>

<script src="https://cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/valine"></script>
<script type="text/javascript">
    var GUEST = ['nick', 'mail', 'link'];
    var meta = 'nick,mail';
    meta = meta.split(',').filter(function (item) {
        return GUEST.indexOf(item) > -1;
    });
    new Valine({
        el: '#vcomments',
        verify: null ,
        notify: null ,
        appId: 'IyAB0PSPRazTPDxitO1ddQ7O-gzGzoHsz',
        appKey: '5rBJTq4KidYF33eXwvRVhtEH',
        placeholder: 'enjoy~',
        avatar: 'mm',
        meta: meta,
        pageSize: '10' || 10,
        visitor: false 
});
</script>

  </body>
</html>
